package com.usian.controller;

import com.usian.CatResult;
import com.usian.pojo.TbItemCat;
import com.usian.service.ItemCategoryService;
import com.usian.service.ItemService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class ItemCategoryController {

    @Autowired
    private ItemCategoryService itemCategoryService;


    /**
     * 根据节点id 查询商品分类
     *
     * @param id
     * @return
     */
    @RequestMapping("selectItemCategoryByParentId")
    public List<TbItemCat> selectItemCategoryByParentId(@RequestParam Long id){
        return itemCategoryService.selectItemCategoryByParentId(id);
    }


    /**
     * 首页查询分类列表
     *
     * @return
     */
    @RequestMapping("selectItemCategoryAll")
    public CatResult selectItemCategoryAll(){
         return itemCategoryService.selectItemCategoryAll();
    }



}
